package org.demo.warehouse.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.demo.warehouse.common.pojo.SysConfig;
import org.demo.warehouse.mapper.SysConfigMapper;
import org.demo.warehouse.service.ISysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 系统配置信息表 服务实现类
 * </p>
 *
 * @author zgc
 * @since 2019-12-03
 */
@Service
public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig> implements ISysConfigService {

    @Autowired
    SysConfigMapper configMapper;

    @Override
    public String getValue(String key) {
        SysConfig config = configMapper.selectOne(Wrappers.<SysConfig>lambdaQuery().eq(SysConfig::getParamKey, key));
        return config.getParamValue();
    }

    @Override
    public String getAuthenticationUrl() {
        return getValue("AUTHENTICATION_URL");
    }
}
